home *** CD-ROM | disk | FTP | other *** search
- From: Hayden Schultz <haydens@tiac.net>
- Message-ID: <313BD2CA.7DBD@tiac.net>
- X-Original-Date: Tue, 05 Mar 1996 00:36:10 -0500
- Path: in2.uu.net!bounce-back
- Date: 05 Mar 96 07:58:26 GMT
- Approved: fjh@cs.mu.oz.au
- Newsgroups: comp.std.c++
- Subject: STL pop_back()
- Organization: Ptech Inc
- References: <4h4hmr$41o@news.rwth-aachen.de> <4h78mr$alj@engnews1.Eng.Sun.COM>
- X-Mailer: Mozilla 2.0GoldB1 (Win95; I)
- X-Auth: PGPMoose V1.1 PGP comp.std.c++
- iQBFAgUBMTv0M+EDnX0m9pzZAQHxVwF/ezH/EY3HMU5OrQn6beCaKvlBSCHCqXrJ
- J50/k9SoXlDNVdo5mFbnDi58nRNub+HY
- =Bzlr
-
- According to _STL Tutorial and Reference Guide_ by Musser and Saini
- (a very good book, btw), the following functions are defined:
-
- template <class T> void vector<t>::pop_back();
- template <class T> void deque<t>::pop_back();
- template <class T> void deque<t>::pop_front();
- template <class T> void list<t>::pop_back();
- template <class T> void list<t>::pop_front();
-
- Other classes may have pop functions, I dunno.
-
- Why don't the pop functions return a copy of the object before they
- blow it away? Another possibility, I suppose, would be an auto_ptr<T>
- so that the object is deleted if it's not used. An auto_ptr<T> is
- about as efficient as deleting it in the pop function, it just changes
- the time it's deleted (which isn't guaranteed anywhere I've read
- anyway).
-
- Why call the methods push and pop if it doesn't act like a stack?
-
- It's not really a big deal (it's easy enough to write my own adapter).
- I'm just curious.
-
- Thanks,
-
- Hayden Schultz
- Ptech, Inc.
- haydens@tiac.net
- hayden@ptechinc.com
- ---
- [ To submit articles: try just posting with your news-reader.
- If that fails, use mailto:std-c++@ncar.ucar.edu
- FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html
- Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html
- Comments? mailto:std-c++-request@ncar.ucar.edu.
- ]
-